<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
</head>
<body>

<div id="container" style="width:800px;height:600px;border:1px solid grey"></div>

<script src="monaco-editor/min/vs/loader.js"></script>
<script>

    var code =                 'public class RichTextArea extends Control {\n' +
        '    public static final String STYLE_CLASS = "rich-text-area";\n' +
        '    public static final DataFormat RTA_DATA_FORMAT = new DataFormat(new String[]{"text/rich-text-area"});\n' +
        '    private static final PseudoClass PSEUDO_CLASS_READONLY = PseudoClass.getPseudoClass("readonly");\n' +
        '    private final ActionFactory actionFactory = new ActionFactory(this);\n' +
        '    private final ObjectProperty<Document> documentProperty = new SimpleObjectProperty(this, "document", new Document());\n' +
        '    private final BooleanProperty autoSaveProperty = new SimpleBooleanProperty(this, "autoSave");\n' +
        '    final ReadOnlyBooleanWrapper modifiedProperty = new ReadOnlyBooleanWrapper(this, "modified");\n' +
        '    private final BooleanProperty editableProperty = new SimpleBooleanProperty(this, "editable", true) {\n' +
        '        protected void invalidated() {\n' +
        '            RichTextArea.this.pseudoClassStateChanged(RichTextArea.PSEUDO_CLASS_READONLY, !this.get());\n' +
        '        }\n' +
        '    };\n' +
        '    private final ReadOnlyObjectWrapper<Selection> selectionProperty;\n' +
        '    final ReadOnlyIntegerWrapper textLengthProperty;\n' +
        '    private final DoubleProperty contentAreaWidthProperty;\n' +
        '    private final ObjectProperty<BiFunction<Integer, GraphicType, Node>> paragraphGraphicFactoryProperty;\n' +
        '    private final ObjectProperty<Function<Node, Consumer<String>>> linkCallbackFactoryProperty;\n' +
        '    private final ObjectProperty<EventHandler<ActionEvent>> onAction;\n' +
        '    private final ObjectProperty<EmojiSkinTone> skinToneProperty;\n' +
        '    final ReadOnlyIntegerWrapper caretPosition;\n' +
        '    private final BooleanProperty tableAllowedProperty;\n' +
        '    private StringProperty promptText;\n' +
        '\n' +
        '    public RichTextArea() {\n' +
        '        this.selectionProperty = new ReadOnlyObjectWrapper(this, "selection", Selection.UNDEFINED);\n' +
        '        this.textLengthProperty = new ReadOnlyIntegerWrapper(this, "textLength");\n' +
        '        this.contentAreaWidthProperty = new SimpleDoubleProperty(this, "contentAreaWidth", 0.0D);\n' +
        '        this.paragraphGraphicFactoryProperty = new SimpleObjectProperty(this, "paragraphGraphicFactory", DefaultParagraphGraphicFactory.getFactory());\n' +
        '        this.linkCallbackFactoryProperty = new SimpleObjectProperty(this, "linkCallbackFactory", DefaultLinkCallbackFactory.getFactory());\n' +
        '        this.onAction = new SimpleObjectProperty(this, "onAction");\n' +
        '        this.skinToneProperty = new SimpleObjectProperty(this, "skinTone", EmojiSkinTone.NO_SKIN_TONE);\n' +
        '        this.caretPosition = new ReadOnlyIntegerWrapper(this, "caretPosition", 0);\n' +
        '        this.tableAllowedProperty = new SimpleBooleanProperty(this, "tableAllowed", true);\n' +
        '        this.promptText = new SimpleStringProperty(this, "promptText", "") {\n' +
        '            protected void invalidated() {\n' +
        '                String txt = this.get();\n' +
        '                if (txt != null && txt.contains("\\n")) {\n' +
        '                    txt = txt.replace("\\n", "");\n' +
        '                    this.set(txt);\n' +
        '                }\n' +
        '\n' +
        '            }\n' +
        '        };\n' +
        '        this.getStyleClass().add("rich-text-area");\n' +
        '    }\n' +
        '\n' +
        '    public final ObjectProperty<Document> documentProperty() {\n' +
        '        return this.documentProperty;\n' +
        '    }\n' +
        '\n' +
        '    public final Document getDocument() {\n' +
        '        return (Document)this.documentProperty.get();\n' +
        '    }\n' +
        '\n' +
        '    public final void setDocument(Document value) {\n' +
        '        this.documentProperty.set(value);\n' +
        '    }\n' +
        '\n' +
        '    public final BooleanProperty autoSaveProperty() {\n' +
        '        return this.autoSaveProperty;\n' +
        '    }\n' +
        '\n' +
        '    public final boolean isAutoSave() {\n' +
        '        return this.autoSaveProperty.get();\n' +
        '    }\n' +
        '\n' +
        '    public final void setAutoSave(boolean value) {\n' +
        '        this.autoSaveProperty.set(value);\n' +
        '    }\n' +
        '\n' +
        '    public final ReadOnlyBooleanProperty modifiedProperty() {\n' +
        '        return this.modifiedProperty.getReadOnlyProperty();\n' +
        '    }\n' +
        '\n' +
        '    public final boolean isModified() {\n' +
        '        return this.modifiedProperty.get();\n' +
        '    }\n' +
        '\n' +
        '    public final BooleanProperty editableProperty() {\n' +
        '        return this.editableProperty;\n' +
        '    }\n' +
        '\n' +
        '    public final boolean isEditable() {\n' +
        '        return this.editableProperty.get();\n' +
        '    }\n' +
        '\n' +
        '    public final void setEditable(boolean value) {\n' +
        '        this.editableProperty.set(value);\n' +
        '    }\n' +
        '\n' +
        '    public final ReadOnlyObjectProperty<Selection> selectionProperty() {\n' +
        '        return this.selectionProperty.getReadOnlyProperty();\n' +
        '    }\n' +
        '\n' +
        '    public final Selection getSelection() {\n' +
        '        return (Selection)this.selectionProperty.get();\n' +
        '    }\n' +
        '\n' +
        '    public final ReadOnlyIntegerProperty textLengthProperty() {\n' +
        '        return this.textLengthProperty.getReadOnlyProperty();\n' +
        '    }\n' +
        '\n' +
        '    public final int getTextLength() {\n' +
        '        return this.textLengthProperty.get();\n' +
        '    }\n' +
        '\n' +
        '    public final DoubleProperty contentAreaWidthProperty() {\n' +
        '        return this.contentAreaWidthProperty;\n' +
        '    }\n' +
        '\n' +
        '    public final double getContentAreaWidth() {\n' +
        '        return this.contentAreaWidthProperty.get();\n' +
        '    }\n' +
        '\n' +
        '    public final void setContentAreaWidth(double value) {\n' +
        '        this.contentAreaWidthProperty.set(value);\n' +
        '    }\n' +
        '\n' +
        '    public final ObjectProperty<BiFunction<Integer, GraphicType, Node>> paragraphGraphicFactoryProperty() {\n' +
        '        return this.paragraphGraphicFactoryProperty;\n' +
        '    }\n' +
        '\n' +
        '    public final BiFunction<Integer, GraphicType, Node> getParagraphGraphicFactory() {\n' +
        '        return (BiFunction)this.paragraphGraphicFactoryProperty.get();\n' +
        '    }\n' +
        '\n' +
        '    public final void setParagraphGraphicFactory(BiFunction<Integer, GraphicType, Node> value) {\n' +
        '        this.paragraphGraphicFactoryProperty.set(value);\n' +
        '    }\n' +
        '\n' +
        '    public final ObjectProperty<Function<Node, Consumer<String>>> linkCallbackFactoryProperty() {\n' +
        '        return this.linkCallbackFactoryProperty;\n' +
        '    }\n' +
        '\n' +
        '    public final Function<Node, Consumer<String>> getLinkCallbackFactory() {\n' +
        '        return (Function)this.linkCallbackFactoryProperty.get();\n' +
        '    }\n' +
        '\n' +
        '    public final void setLinkCallbackFactory(Function<Node, Consumer<String>> value) {\n' +
        '        this.linkCallbackFactoryProperty.set(value);\n' +
        '    }\n' +
        '\n' +
        '    public final ObjectProperty<EventHandler<ActionEvent>> onActionProperty() {\n' +
        '        return this.onAction;\n' +
        '    }\n' +
        '\n' +
        '    public final EventHandler<ActionEvent> getOnAction() {\n' +
        '        return (EventHandler)this.onAction.get();\n' +
        '    }\n' +
        '\n' +
        '    public final void setOnAction(EventHandler<ActionEvent> value) {\n' +
        '        this.onAction.set(value);\n' +
        '    }\n' +
        '\n' +
        '    public final ObjectProperty<EmojiSkinTone> skinToneProperty() {\n' +
        '        return this.skinToneProperty;\n' +
        '    }\n' +
        '\n' +
        '    public final EmojiSkinTone getSkinTone() {\n' +
        '        return (EmojiSkinTone)this.skinToneProperty.get();\n' +
        '    }\n' +
        '\n' +
        '    public final void setSkinTone(EmojiSkinTone value) {\n' +
        '        this.skinToneProperty.set(value);\n' +
        '    }\n' +
        '\n' +
        '    public final int getCaretPosition() {\n' +
        '        return this.caretPosition.get();\n' +
        '    }\n' +
        '\n' +
        '    public final ReadOnlyIntegerProperty caretPositionProperty() {\n' +
        '        return this.caretPosition.getReadOnlyProperty();\n' +
        '    }\n' +
        '\n' +
        '    public final BooleanProperty tableAllowedProperty() {\n' +
        '        return this.tableAllowedProperty;\n' +
        '    }\n' +
        '\n' +
        '    public final boolean isTableAllowed() {\n' +
        '        return this.tableAllowedProperty.get();\n' +
        '    }\n' +
        '\n' +
        '    public final void setTableAllowed(boolean value) {\n' +
        '        this.tableAllowedProperty.set(value);\n' +
        '    }\n' +
        '\n' +
        '    public final StringProperty promptTextProperty() {\n' +
        '        return this.promptText;\n' +
        '    }\n' +
        '\n' +
        '    public final String getPromptText() {\n' +
        '        return (String)this.promptText.get();\n' +
        '    }\n' +
        '\n' +
        '    public final void setPromptText(String value) {\n' +
        '        this.promptText.set(value);\n' +
        '    }\n' +
        '\n' +
        '    public final ActionFactory getActionFactory() {\n' +
        '        return this.actionFactory;\n' +
        '    }\n' +
        '\n' +
        '    protected SkinBase<RichTextArea> createDefaultSkin() {\n' +
        '        return new RichTextAreaSkin(this);\n' +
        '    }\n' +
        '\n' +
        '    public String getUserAgentStylesheet() {\n' +
        '        return this.getClass().getResource("rich-text-area.css").toExternalForm();\n' +
        '    }\n' +
        '}';

    require.config({ paths: { 'vs': 'monaco-editor/min/vs' }});
    require(['vs/editor/editor.main'], function() {
        var editor = monaco.editor.create(document.getElementById('container'), {
            value: [
                code
            ].join('\n'),
            language: 'java',
            automaticLayout: true,
            tabSize: 4,
            minimap: {
                enabled: false, // 不要小地图
            },

        });
        editor.getValue()

    });
</script>
</body>
</html>